package com.zed.api.useradmin;

/**
 * 使用登录凭证没找到对应帐号时抛出的例外
 * @author Zed
 *
 */
public class AccountNotFoundWithLoginCertificateException extends AccountException {

	private static final long serialVersionUID = 8044226220426779850L;

	private LoginCertificate loginCertificate;
	
	/**
	 * 
	 */
	protected AccountNotFoundWithLoginCertificateException() {
	}

	/**
	 * 使用{@code loginCredential}创建新实例
	 * @param loginCertificate {@link LoginCertificate}
	 */
	public AccountNotFoundWithLoginCertificateException(LoginCertificate loginCertificate) {
		super("account not found: loginCredential=" + loginCertificate.toString() + ".");
		this.loginCertificate = loginCertificate;
	}

	/**
	 * 登录凭证
	 * @return {@link LoginCertificate}
	 */
	public LoginCertificate getLoginCredential() {
		return this.loginCertificate;
	}
	
	@Override
	public String getLocalizedMessage() {
		return String.format("未找到登录凭证[域=%s,编号=%s]", this.getLoginCredential().getDomain(), this.getLoginCredential().getIdentifier());
	}

}
